<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateTeachingSubjectTable extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('teaching_subject', function (Blueprint $table) {
            $table->bigInteger('id', true);
            $table->bigInteger('user_id')->nullable()->comment('用户id');
            $table->json('subject_dic_items')->nullable()->comment('学科字典项code');
            $table->string('subject_name', 50)->nullable()->comment('科目名称');
            $table->json('grade_dic_items')->nullable()->comment('年级字典项');
            $table->string('master', 255)->default('')->comment('班主任');
            $table->string('deputy_master', 255)->default('')->comment('副班主任');
            $table->date('start_date')->nullable();
            $table->date('end_date')->nullable();
            $table->decimal('class_hour', 10)->nullable();
            $table->bigInteger('data_version_id')->nullable();
            $table->bigInteger('form_instance_id')->nullable();
            $table->integer('deleted')->nullable()->default(0);
            $table->boolean('is_import')->default(false)->comment('是否导入：1-是');
            $table->dateTime('created_at')->nullable()->useCurrent();
            $table->bigInteger('creator_id')->nullable()->default(0);
            $table->dateTime('updated_at')->nullable()->useCurrent();
            $table->bigInteger('updater_id')->nullable()->default(0);
            $table->json('class_item')->nullable()->comment('班级');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('teaching_subject');
    }
};
